package com.poetic.network.flow.watermark;

import com.poetic.network.flow.domain.SensorReading;
import org.apache.flink.streaming.api.functions.AssignerWithPunctuatedWatermarks;
import org.apache.flink.streaming.api.watermark.Watermark;

import javax.annotation.Nullable;

/**
 * <pre>
 *  TODO
 * Created by lianghuikun on 2020-09-13.
 * </pre>
 *
 * @author lianghuikun
 */
public class MyAssigner2 implements AssignerWithPunctuatedWatermarks<SensorReading> {
    @Nullable
    @Override
    public Watermark checkAndGetNextWatermark(SensorReading lastElement, long extractedTimestamp) {

        return new Watermark(extractedTimestamp);
    }

    @Override
    public long extractTimestamp(SensorReading element, long recordTimestamp) {
        return element.getTimestamp();
    }
}
